package com.deyuanyun.pic.pipe.controller.vo;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.domain.PipeCross;
import com.deyuanyun.pic.pipe.domain.Reducer;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 穿跨越信息表
 */
public class PipeCrossVO extends BaseVO<PipeCross> {

    // 管道名称
    private String pipeLineName;
    // 穿跨越编号
    private String crossingNumber;
    // 穿跨越类型
    private String crossingType;
    // 穿跨越名称
    private String crossingName;
    // 穿跨越对象
    private String crossingTarget;
    // 穿跨越方式
    private String crossingMethod;
    // 起点绝对距离(m)
    private String fromMileage;
    // 起点相对最近参考点
    private String fromReference;
    // 起点相对最近参考点距离(m)
    private String fromReferenceDistance;
    // 终点绝对距离(m)
    private String toMileage;
    // 终点相对最近参考点
    private String toReference;
    // 终点相对最近参考点距离(m)
    private String toReferenceDistance;
    // 位置描述
    private String locationDescription;
    // 穿跨越长度（m）
    private String length;
    // 管节数
    private Integer number;
    // 材质
    private String material;
    // 壁厚（mm）
    private String wallThickness;
    // 稳管措施
    private String pipeStableMeasures;
    // 是否有套管
    private String isSleeve;
    // 防护层材料
    private String coatingMaterial;
    // 防护层厚度（mm）
    private String coatingThickness;
    // 竣工资料编号
    private String completionDataNumber;
    // 施工单位
    private String assemblyCompany;
    // 监理单位
    private String inspectingCompany;
    // 检测单位
    private String testingCompany;

    // 链接计算结果表
    private String gisId;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getCrossingNumber() {
        return crossingNumber;
    }

    public void setCrossingNumber(String crossingNumber) {
        this.crossingNumber = crossingNumber;
    }

    public String getCrossingType() {
        return crossingType;
    }

    public void setCrossingType(String crossingType) {
        this.crossingType = crossingType;
    }

    public String getCrossingName() {
        return crossingName;
    }

    public void setCrossingName(String crossingName) {
        this.crossingName = crossingName;
    }

    public String getCrossingTarget() {
        return crossingTarget;
    }

    public void setCrossingTarget(String crossingTarget) {
        this.crossingTarget = crossingTarget;
    }

    public String getCrossingMethod() {
        return crossingMethod;
    }

    public void setCrossingMethod(String crossingMethod) {
        this.crossingMethod = crossingMethod;
    }

    public String getFromMileage() {
        return fromMileage;
    }

    public void setFromMileage(String fromMileage) {
        this.fromMileage = fromMileage;
    }

    public String getFromReference() {
        return fromReference;
    }

    public void setFromReference(String fromReference) {
        this.fromReference = fromReference;
    }

    public String getFromReferenceDistance() {
        return fromReferenceDistance;
    }

    public void setFromReferenceDistance(String fromReferenceDistance) {
        this.fromReferenceDistance = fromReferenceDistance;
    }

    public String getToMileage() {
        return toMileage;
    }

    public void setToMileage(String toMileage) {
        this.toMileage = toMileage;
    }

    public String getToReference() {
        return toReference;
    }

    public void setToReference(String toReference) {
        this.toReference = toReference;
    }

    public String getToReferenceDistance() {
        return toReferenceDistance;
    }

    public void setToReferenceDistance(String toReferenceDistance) {
        this.toReferenceDistance = toReferenceDistance;
    }

    public String getLocationDescription() {
        return locationDescription;
    }

    public void setLocationDescription(String locationDescription) {
        this.locationDescription = locationDescription;
    }

    public String getLength() {
        return length;
    }

    public void setLength(String length) {
        this.length = length;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getMaterial() {
        return material;
    }

    public void setMaterial(String material) {
        this.material = material;
    }

    public String getWallThickness() {
        return wallThickness;
    }

    public void setWallThickness(String wallThickness) {
        this.wallThickness = wallThickness;
    }

    public String getPipeStableMeasures() {
        return pipeStableMeasures;
    }

    public void setPipeStableMeasures(String pipeStableMeasures) {
        this.pipeStableMeasures = pipeStableMeasures;
    }

    public String getIsSleeve() {
        return isSleeve;
    }

    public void setIsSleeve(String isSleeve) {
        this.isSleeve = isSleeve;
    }

    public String getCoatingMaterial() {
        return coatingMaterial;
    }

    public void setCoatingMaterial(String coatingMaterial) {
        this.coatingMaterial = coatingMaterial;
    }

    public String getCoatingThickness() {
        return coatingThickness;
    }

    public void setCoatingThickness(String coatingThickness) {
        this.coatingThickness = coatingThickness;
    }

    public String getCompletionDataNumber() {
        return completionDataNumber;
    }

    public void setCompletionDataNumber(String completionDataNumber) {
        this.completionDataNumber = completionDataNumber;
    }

    public String getAssemblyCompany() {
        return assemblyCompany;
    }

    public void setAssemblyCompany(String assemblyCompany) {
        this.assemblyCompany = assemblyCompany;
    }

    public String getInspectingCompany() {
        return inspectingCompany;
    }

    public void setInspectingCompany(String inspectingCompany) {
        this.inspectingCompany = inspectingCompany;
    }

    public String getTestingCompany() {
        return testingCompany;
    }

    public void setTestingCompany(String testingCompany) {
        this.testingCompany = testingCompany;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    public void fromDomain(PipeCross domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 穿跨越编号
        this.crossingNumber = domain.getCrossingNumber();
        // 穿跨越类型
        this.crossingType = CodeUtil.getName(domain.getCrossingType());
        // 穿跨越名称
        this.crossingName = domain.getCrossingName();
        // 穿跨越对象
        this.crossingTarget = CodeUtil.getName(domain.getCrossingTarget());
        // 穿跨越方式
        this.crossingMethod = CodeUtil.getName(domain.getCrossingMethod());
        // 起点绝对距离(m)
        this.fromMileage = NumberFormat.format(domain.getFromMileage(), NumberFormat.FMT_PLACES3);
        // 起点相对最近参考点
        this.fromReference = domain.getFromReference();
        // 起点相对最近参考点距离(m)
        this.fromReferenceDistance = NumberFormat.format(domain.getFromReferenceDistance(), NumberFormat.FMT_PLACES3);
        // 终点绝对距离(m)
        this.toMileage = NumberFormat.format(domain.getToMileage(), NumberFormat.FMT_PLACES3);
        // 终点相对最近参考点
        this.toReference = domain.getToReference();
        // 终点相对最近参考点距离(m)
        this.toReferenceDistance = NumberFormat.format(domain.getToReferenceDistance(), NumberFormat.FMT_PLACES3);
        // 位置描述
        this.locationDescription = domain.getLocationDescription();
        // 穿跨越长度（m）
        this.length = NumberFormat.format(domain.getLength(), NumberFormat.FMT_PLACES3);
        // 管节数
        this.number = domain.getPnumber();
        // 材质
        this.material = CodeUtil.getName(domain.getMaterial());
        // 壁厚（mm）
        this.wallThickness = NumberFormat.format(domain.getWallThickness());
        // 稳管措施
        this.pipeStableMeasures = CodeUtil.getName(domain.getPipeStableMeasures());
        // 是否有套管
        this.isSleeve = convert(domain.getIsSleeve());
        // 防护层材料
        this.coatingMaterial = CodeUtil.getName(domain.getCoatingMaterial());
        // 防护层厚度（mm）
        this.coatingThickness = NumberFormat.format(domain.getCoatingThickness());
        // 竣工资料编号
        this.completionDataNumber = domain.getCompletionDataNumber();
        // 施工单位
        this.assemblyCompany = domain.getAssemblyCompany();
        // 监理单位
        this.inspectingCompany = domain.getInspectingCompany();
        // 检测单位
        this.testingCompany = domain.getTestingCompany();
        // gis地址
        this.gisId = domain.getGisId();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public Page<PipeCrossVO> fromDomainList(Page<PipeCross> domainList) {
        Page<PipeCrossVO> list = new Page<PipeCrossVO>();
        for (PipeCross pipeCross : domainList) {
            PipeCrossVO pipeCrossVO = new PipeCrossVO();
            pipeCrossVO.fromDomain(pipeCross);
            list.add(pipeCrossVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}